package com.stefanini.pe.bbva.mbl.in.dao;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.stefanini.pe.bbva.mbl.carga.in.to.LogCargaError;
import com.stefanini.pe.bbva.mbl.in.dao.iface.LogErrorDAO;
import com.stefanini.pe.bbva.mbl.in.utils.Util;

import org.apache.log4j.Logger;

public class LogErrorDAOImpl extends SqlMapClientDaoSupport implements LogErrorDAO {
	private static final Logger logger = Logger.getLogger(LogErrorDAOImpl.class);
	
	private Map<String, SqlMapClientTemplate> commandMap;
	
    public Map<String, SqlMapClientTemplate> getCommandMap() {
		return commandMap;
	}

	public void setCommandMap(Map<String, SqlMapClientTemplate> commandMap) {
		this.commandMap = commandMap;
	}

    public LogErrorDAOImpl() {
        super();
    }
        
	public List selectAll(LogCargaError log) {
		List records= new ArrayList();
		
		try{
		    logger.info("Inicio");		
			
	        records = (List) getSqlMapClientTemplate().queryForList("LOG_CARGA_ERROR.ibatorgenerated_selectAll",null);
	      
	      
	        logger.info("Fin");
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
		}
		
		return records;
	}

	
    public List selectByCriteria(LogCargaError logError)  {
	  List records= new ArrayList(); 
  	  
	  try {
		  logger.info("Inicio");  
		  
  		  records = (List) getSqlMapClientTemplate().queryForList("LOG_CARGA_ERROR.ibatorgenerated_selectByCriteria", logError);
  		  
  		  logger.info("Fin");
      } catch (Exception e) {
    	  logger.error(e.getMessage(), e);
	  }
      
	  return records;
	}
}